<?php
$b = file('b.csv');
$barr=[];
foreach($b as $v){
    $arr1=explode(',',$v);
    $name =trim($arr1[1]);
    $phone =trim($arr1[5]);
    $barr[$name][$phone]=$arr1;
}
$a = file('a.csv');
$tong=$butong=$no=[];
$aarr=[];
foreach($a as $v){
    $v = trim($v);
    $arr1=explode(',',$v);
    $name =trim($arr1[1]);
    $phone =trim($arr1[5]);
    $class =trim($arr1[3]);
    if(!empty($barr[$name][$phone])){
        $olddata = trim($barr[$name][$phone][3]);
        if($olddata==$class){
            $tong[]=$v;
        }else{
            $butong[]=trim($v).','.$olddata;
        }
    }else{
        $no[]=$v;
    }
    
}
$title=['id','名称','学校','班级','班级昵称','电话','status','is_delete'];
$result[]=implode(',',$title);
$result[]='不同';
$result[]=implode("\n",$butong);
$result[]='相同';
$result[]=implode("\n",$tong);
$result[]='不存在';
$result[]=implode("\n",$no);
echo implode("\n",$result);exit;

?>